import {findAll,byWiterIdFin} from '@/api/order.js'
export default {
    namespaced:true,
    state:{
        //后台总数据
        totalData:{},
        orderData:[],
        WaiterOrder:[]
    },
    //对总数据进行划分
    getters:{
        total:state=>state.totalData.total,
        orderData:state=>state.totalData.list,
    },
    mutations:{
        changeTotalData(state,data){
            state.totalData=data;
            state.orderData=data.list
        },
        changeWaiterOrder(state,data){
            state.WaiterOrder=data;
        }
    },
    actions:{
        //查找订单信息
        findAll({commit},payload){
            findAll(payload).then(res=>{
                commit('changeTotalData',res.data)
            })
        },
        //通过员工id查找订单信息
        byWiterIdFin({commit},payload){
            byWiterIdFin(payload).then(res=>{
                commit('changeWaiterOrder',res.data)
            })
        }
    }
}